package po

import (
	"astgram/model/vo"
	"github.com/jinzhu/gorm"
)

type Image struct {
	UserID int64  `json:"user_id"`
	URL    string `json:"url"`

	gorm.Model
}

func (Image) TableName() string {
	return "image"
}

func (i *Image) ToVo() *vo.Image {
	imgVo := &vo.Image{
		ImageID: int64(i.ID),
		User: &vo.User{
			UserID:   i.UserID,
			Username: "asu",
			HeadURL:  "https://cdn.asueeer.com/images/202111/1916298011_1636728808_47.jpeg",
		},
		ImgURL:   i.URL,
		CreateAt: i.CreatedAt.Format("2006-01-02 15:04"),
	}
	return imgVo
}
